#include"head.h"
//线程函数
    


int initPthread(threads *threads,int num)
{   
    pthread_mutex_init(&threads->lock,NULL);

    pthread_cond_init(&threads->cont,NULL);
    
    threads->num=num;
    threads->is_exit=0;//初始化不退出的状态
    
    //别忘了初始化队列
    memset(&threads->queue,0,sizeof(Queue));
    //线程数组
    threads->thread_id = (pthread_t*)calloc(num,sizeof(pthread_t));
    for(int i=0;i<num;i++){
        
        int p_pid=pthread_create(&threads->thread_id[i],NULL,func,(void*)threads);
        THREAD_ERROR_CHECK(p_pid,"creat_thread");
        

    }
    
    return 0;
}

